package com.cskaoyan.chapter0504;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author:WalterChan
 * @Decription:AutoUnBoxing
 * @Date Created in 2024-06-11-21:53
 */
public class AutoUnBoxing {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();

        list.add(Integer.valueOf(1));
        list.add(Integer.valueOf(2));
        list.add(Integer.valueOf(3));
        //这里没有自动拆箱
        Integer integer = list.get(0);
        //这里自动拆箱
        int unBoxingInt1 = list.get(0);
        //其实编译器自动翻译成下面这样
        int unBoxingInt2 = list.get(0).intValue();

        System.out.println(list);
    }
}
